﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using kTudu.Web.Models;
using kTudu.Web.Applications;

namespace kTudu.Web.Factories
{
    public class ApplicationFactory
    {
        protected Entities _context = null;

        public ApplicationFactory()
        {
            _context = new Entities();
        }

        public T GetApplication<T>()
            where T : BaseApplication
        {
            if (typeof(T) == typeof(UserClientApplication))
                return new UserClientApplication(_context) as T;
            else if (typeof(T) == typeof(RolApplication))
                return new RolApplication(_context) as T;
            else
                throw new Exception("");
        }
    }
}